import grace from "../../../utils/grace.js";

var app = getApp();

grace.page({
  data: {
    userInfo: {},
    hasUserInfo: false,
    user_code: ''
  },
  onShow() {
    let that = this;
    if (wx.getStorageSync('userInfo')) {
      that.$data = {
        userInfo: wx.getStorageSync('userInfo'),
        hasUserInfo: true,
        user_code: wx.getStorageSync('user_code')
      }
    }
  },
  orderList(e) {
    wx.navigateTo({
      url: "/pages/mall/order/index?state=" + e.currentTarget.dataset.state
    })
  },
  calling() {
    wx.makePhoneCall({
      phoneNumber: '15894623696',
      success: function () {
        console.log("拨打电话成功！")
      },
      fail: function () {
        console.log("拨打电话失败！")
      }
    })
  },
  login(){
    wx.removeStorageSync('userInfo');
    wx.navigateTo({
      url: '/pages/common/authorize/index'
    })
  },
  relogin() {
    let school_id = wx.getStorageSync('school_id')
    wx.clearStorageSync()
    wx.setStorageSync('school_id', school_id)
    wx.navigateTo({
      url: '/pages/common/authorize/index'
    })
  }
})